home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / PeerAware 1.03 / PeerAware-Setup.exe / Html / scripts / nczXMLDOMWrapper.js < prev    next >
Text File  |  2006-11-20  |  2KB  |  94 lines

  1. var ARR_ACTIVEX=["MSXML4.DOMDocument","MSXML3.DOMDocument","MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XmlDom"];
  2. var STR_ACTIVEX="";
  3. var isIE=navigator.userAgent.toLowerCase().indexOf("msie")>-1;
  4. var isMoz=document.implementation&&document.implementation.createDocument;
  5. if(isIE){
  6. var bFound=false;
  7. for(var i=0;i<ARR_ACTIVEX.length&&!bFound;i++){
  8. try{
  9. var objXML=new ActiveXObject(ARR_ACTIVEX[i]);
  10. STR_ACTIVEX=ARR_ACTIVEX[i];
  11. bFound=true;
  12. }
  13. catch(objException){
  14. }
  15. }
  16. if(!bFound){
  17. throw "No DOM DOcument found on your computer.";
  18. }
  19. }
  20. if(isMoz){
  21. Document.prototype.loadXML=function(_1){
  22. changeReadyState(this,1);
  23. var _2=new DOMParser();
  24. var _3=_2.parseFromString(_1,"text/xml");
  25. while(this.hasChildNodes()){
  26. this.removeChild(this.lastChild);
  27. }
  28. for(var i=0;i<_3.childNodes.length;i++){
  29. var _5=this.importNode(_3.childNodes[i],true);
  30. this.appendChild(_5);
  31. }
  32. handleOnLoad(this);
  33. };
  34. Node.prototype.__defineGetter__("xml",_Node_getXML);
  35. Document.prototype.readyState="0";
  36. Document.prototype.__load__=Document.prototype.load;
  37. Document.prototype.load=_Document_load;
  38. Document.prototype.onreadystatechange=null;
  39. Document.prototype.parseError=0;
  40. }
  41. function jsXML(){
  42. }
  43. jsXML.createDOMDocument=function(_6,_7){
  44. var _8=null;
  45. if(isMoz){
  46. _8=document.implementation.createDocument(_6,_7,null);
  47. _8.addEventListener("load",_Document_onload,false);
  48. }else{
  49. if(isIE){
  50. _8=new ActiveXObject(STR_ACTIVEX);
  51. if(_7){
  52. if(_6){
  53. _8.loadXML("<a0:"+_7+" xmlns:a0=\""+_6+"\" />");
  54. }else{
  55. _8.loadXML("<"+_7+"/>");
  56. }
  57. }
  58. }
  59. }
  60. return _8;
  61. };
  62. function _Node_getXML(){
  63. var _9=new XMLSerializer;
  64. var _a=_9.serializeToString(this);
  65. return _a;
  66. }
  67. function _Document_load(_b){
  68. this.parseError=0;
  69. changeReadyState(this,1);
  70. try{
  71. this.__load__(_b);
  72. }
  73. catch(objException){
  74. this.parseError=-9999999;
  75. changeReadyState(this,4);
  76. }
  77. }
  78. function _Document_onload(){
  79. handleOnLoad(this);
  80. }
  81. function handleOnLoad(_c){
  82. if(!_c.documentElement||_c.documentElement.tagName=="parsererror"){
  83. _c.parseError=-9999999;
  84. }
  85. changeReadyState(_c,4);
  86. }
  87. function changeReadyState(_d,_e){
  88. _d.readyState=_e;
  89. if(_d.onreadystatechange!=null&&typeof _d.onreadystatechange=="function"){
  90. _d.onreadystatechange();
  91. }
  92. }
  93.  
  94.